﻿<style>
    #tab.table > thead > tr > th, #tab.table > tbody > tr > th, #tab.table > tfoot > tr > th, #tab.table > thead > tr > td, #tab.table > tbody > tr > td, #tab.table > tfoot > tr > td {
        vertical-align: middle;
        text-align: center;
    }

    .default-tab input, .default-tab select {
        border: none;
        box-shadow: none !important;
    }

    a .iconfont {
        margin-right: 5px;
        font-size: 12px;
    }
</style>
<div class="form-horizontal" ms-controller="ZCMX">

    <div style="margin: 0 80px;">
        <div>
            <ul class="clearfix" style="display: block; padding: 0">
                <li class="add-item  add-width fl-left">
                    <label class="add-item-label">单位</label>
                    <div class="add-ic">
                        <div class="input-group ">
                            <input type="text" class="form-control" autocomplete="off" isinit="Y" onfocus="this.blur()" ms-duplex="modelData.dwname" step="WIDTH: 300PX;">
                            <span class="input-group-addon" style="height: 34px;" ms-click="seldw()">选择单位</span>

                        </div>
                    </div>
                </li>
                <li class="add-item add-width fl-right">
                    <label class="add-item-label"><i>*</i>项目期别</label>
                    <div class="add-ic">
                        <select name="conType" id="conType" ms-duplex="modelData.xmqbid" class="form-control szhl_require">
                            <option value="">请选择</option>
                            <option ms-repeat-item="xmqb" ms-attr-value="item.ID">{{item.Remark1}}--{{item.Remark2}}</option>
                        </select>
                    </div>
                </li>

                <li class="add-item add-width fl-left">
                    <label class="add-item-label">计划科目</label>
                    <div class="add-ic">
                        <div class="input-group ">
                            <input type="text" class="form-control" autocomplete="off" isinit="Y" onfocus="this.blur()" ms-duplex="modelData.jhsxnamezc" id="jhsxname" step="    WIDTH: 300PX;">

                            <span class="input-group-addon" style="height: 34px;" ms-click="seljhsx()">选择计划科目</span>
                        </div>
                    </div>

                </li>


                <!--<li class="add-item add-width fl-left">
                    <label class="add-item-label"><i>*</i>合同类别</label>
                    <div class="add-ic">
                        <select name="conType" id="conType" ms-duplex="modelData.htlb" class="form-control szhl_require">
                            <option value="">请选择</option>
                            <option ms-repeat-item="htlb" ms-attr-value="item.ID">{{item.TypeName}}</option>
                        </select>
                    </div>
                </li>-->
                <div id="htdiv" style="display:none">

                    <li class="add-item add-width fl-right">
                        <label class="add-item-label"><i>*</i>合同编号</label>
                        <div class="add-ic">
                            <input type="text" ms-duplex="modelData.htbh" maxlength="400" class="form-control " />
                        </div>
                    </li>
                    <li class="add-item add-width fl-left">

                        <label class="add-item-label"><i>*</i>对方单位</label>
                        <div class="add-ic">
                            <input type="text" ms-duplex="modelData.dfdw" maxlength="400" class="form-control dfdw" />
                        </div>


                    </li>
                    <li class="add-item add-width fl-right">
                        <label class="add-item-label"><i>*</i>合同名称</label>
                        <div class="add-ic">
                            <input type="text" ms-duplex="modelData.htnr" maxlength="400" class="form-control " />
                        </div>
                    </li>
                    <li class="add-item add-width fl-left">
                        <label class="add-item-label"><i>*</i>是否预付款</label>
                        <div class="add-ic">

                            <select ms-duplex="modelData.sfyfk" class="form-control">
                                <option value="">请选择</option>
                                <option value="是">是</option>
                                <option value="否">否</option>

                            </select>
                        </div>
                    </li>
                    <li class="add-item add-width fl-right">
                        <label class="add-item-label"><i>*</i>付款级次</label>
                        <div class="add-ic">
                            <!--    <select ms-duplex="modelData.fkjcid" class="form-control">
                    <option value="">请选择</option>
                    <option ms-repeat-item="fkjcdata" ms-attr-value="item.ID">{{item.TypeName}}</option>
                </select>-->
                            <select ms-duplex="modelData.fkjcid" class="form-control">
                                <option value="一般">一般</option>
                                <option value="重要">重要</option>
                                <option value="紧急">紧急</option>

                            </select>
                        </div>
                    </li>

                    <li class="add-item add-width fl-left">
                        <label class="add-item-label"><i>*</i>合同节点</label>
                        <!--<div class="add-ic">
                <select ms-duplex="modelData.htjdid" class="form-control">
                    <option value="">请选择</option>
                    <option ms-repeat-item="htjddata" ms-attr-value="item.ID">{{item.TypeName}}</option>
                </select>
            </div>-->
                        <div class="add-ic">
                            <div class="input-group ">
                                <input type="text" class="form-control" autocomplete="off" isinit="Y" onfocus="this.blur()" id="htjdname" ms-duplex="modelData.htjdnamezc" step="    WIDTH: 300PX;">
                                <span class="input-group-addon" style="height: 34px;" ms-click="selhtjd()">选择合同节点</span>
                            </div>
                        </div>
                    </li>



                    <li class="add-item add-width fl-right">
                        <label class="add-item-label"><i>*</i>合同累计应付</label>
                        <div class="add-ic">
                            <input type="text" ms-duplex="modelData.yfkze" maxlength="400" class="form-control" />
                        </div>
                    </li>
                    <li class="add-item add-width fl-left">
                        <label class="add-item-label"><i>*</i>合同累计已付额</label>
                        <div class="add-ic">
                            <input type="text" ms-duplex="modelData.yfe" maxlength="400" class="form-control" />
                        </div>
                    </li>
                    <li class="add-item add-width fl-right">
                        <label class="add-item-label"><i>*</i>合同付款比例</label>
                        <div class="add-ic">
                            <input type="text" ms-duplex="modelData.yfbl" maxlength="400" class="form-control" />
                        </div>
                    </li>
                    <li class="add-item add-width fl-left">
                        <label class="add-item-label"><i>*</i>截止当前欠额</label>
                        <div class="add-ic">
                            <input type="text" ms-duplex="modelData.dqqk" maxlength="400" class="form-control " />
                        </div>
                    </li>
                    <li class="add-item add-width fl-right">
                        <label class="add-item-label"><i>*</i>合同签批进度</label>
                        <div class="add-ic">

                            <select ms-duplex="modelData.htqpzt" class="form-control" style="width:49%;display:inline">
                                <option value="">请选择</option>
                                <option value="0">已签批</option>
                                <option value="1">已完工未签批</option>
                                <option value="2">未完工</option>

                            </select>
                            <input type="text" class="form-control szhl_form_date null" ms-duplex="modelData.htqpdate" placeholder="签批时间" style="width:49%;display:inline" ms-if="modelData.htqpzt=='0'" />
                        </div>
                    </li>
                </div>
                    <!--    <li class="add-item add-width fl-right">
                <label class="add-item-label"><i>*</i>账龄</label>
                <div class="add-ic">
                    <input type="text" ms-duplex="modelData.zhangling" maxlength="400" class="form-control " />
                </div>
            </li>-->
                    <li class="add-item add-widthall">
                        <div class="default-tab ft14 ">
                            <table class="table table-hover table-bordered" id="tab">
                                <thead style="background: #f7f7f7;">
                                    <tr>
                                        <th width="100px">分月计划</th>
                                        <th width="150px">金额(元)</th>
                                        <th width="150px" colspan="3">描述</th>

                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td>
                                            第一月
                                        </td>
                                        <td>
                                            <input type="text" class="form-control yje" ms-duplex="modelData.je1" placeholder="请输入金额" />
                                        </td>

                                        <td colspan="3">
                                            <input type="text" class="form-control" ms-duplex="modelData.je1dec" placeholder="请输入描述" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            第二月
                                        </td>
                                        <td>
                                            <input type="text" class="form-control yje" ms-duplex="modelData.je2" placeholder="请输入金额" />
                                        </td>

                                        <td colspan="3">
                                            <input type="text" class="form-control" ms-duplex="modelData.je2dec" placeholder="请输入描述" />
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            第三月
                                        </td>
                                        <td>
                                            <input type="text" class="form-control yje" ms-duplex="modelData.je3" placeholder="请输入金额" />
                                        </td>

                                        <td colspan="3">
                                            <input type="text" class="form-control" ms-duplex="modelData.je3dec" placeholder="请输入描述" />
                                        </td>
                                    </tr>

                                    <tr>
                                        <td>金额小计</td>
                                        <td><input type="text" ms-duplex="modelData.jexj" maxlength="400" class="form-control szhl_require" /></td>
                                        <td colspan="3"><input type="text" class="form-control" ms-duplex="modelData.remark" placeholder="请输入备注" /></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            按周分解
                                        </td>
                                        <td>
                                            第一周
                                        </td>
                                        <td>
                                            第二周
                                        </td>
                                        <td>
                                            第三周
                                        </td>
                                        <td>
                                            第四周
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            周金额
                                        </td>
                                        <td>
                                            <input type="text" class="form-control" ms-duplex="modelData.week1" placeholder="请输入金额" />
                                        </td>
                                        <td>
                                            <input type="text" class="form-control" ms-duplex="modelData.week2" placeholder="请输入金额" />
                                        </td>
                                        <td>
                                            <input type="text" class="form-control" ms-duplex="modelData.week3" placeholder="请输入金额" />
                                        </td>
                                        <td>
                                            <input type="text" class="form-control" ms-duplex="modelData.week4" placeholder="请输入金额" />
                                        </td>
                                    </tr>
                                </tbody>

                            </table>
                        </div>
                    </li>
                    <li class="add-item  add-widthall">
                        <label class="add-item-label">变更理由</label>
                        <div class="add-ic">
                            <input type="text" ms-duplex="bgmodelData.BGLY" maxlength="400" class="form-control" />
                        </div>

                    </li>

</ul>
        </div>

    </div>

    
</div>
<script>
    var tempmodel = avalon.define({
        $id: "ZCMX",
        name: "支出明细",
        bgmodelData: { "BGJE": "", "BGLY": "", "JHMXID": "", "ID": "0", "intProcessStanceid": "0", "Remark2": "" },
        modelData: { "JHID": "", "xmqbid": "", "jhsxid": "", "cplxid": "", "hklxid": "", "jhsxnamezc": "", "htjdnamezc": "", "htlb": "", "htbh": "", "dfdw": "", "htnr": "", "sfyfk": "", "fkjcid": "一般", "htjdid": "", "yfkze": "0", "yfe": "0", "yfbl": "", "dqqk": "", "zhangling": "0", "jexj": "0", "je1": "0", "je2": "0", "je3": "0", "je1dec": "", "je2dec": "", "je3dec": "", "remark": "", "week1": "0", "week2": "0", "week3": "0", "week4": "0", "dwname": "", "dwid": "", "zxje": "0", "status": "0", "intProcessStanceid": "0", "isbg": "N", "htqpzt": "", "htqpdate": "", "remark1": "", "drid": "0" },
        jhdata: {},
        iswf: true,//是否属于流程表单
        fkjcdata: [],
        htjddata: [],
        xmqb: [],
        htlb: [],
        dfdw: [],
        selhtjd: function () {
            top.ComFunJS.winbtnwin("/ViewV5/AppPage/JHZD/HTJDSELLIST.html", "选择合同节点", 600, 470, {}, function (layero, index) {
                var frameid = $("iframe", $(layero)).attr('id');
                var htjddata = ComFunJS.isIE() ? top.window.frames[frameid].model.getseldata() : top.window.frames[frameid].contentWindow.model.getseldata();
                tempmodel.modelData.htjdid = htjddata[0].ID;
                tempmodel.modelData.htjdnamezc = htjddata[0].TypeName;

                $("#htjdname").val(htjddata[0].TypeName)
                top.layer.close(index)

            })
        },
        seldw: function () {
            top.ComFunJS.winbtnwin("/ViewV5/AppPage/XTGL/BranchSelect.html?isqx=Y", "选择单位", 500, 470, {}, function (layero, index) {
                var frameid = $("iframe", $(layero)).attr('id');
                var branch = ComFunJS.isIE() ? top.window.frames[frameid].getselectedbranch() : top.window.frames[frameid].contentWindow.getselectedbranch();
                tempmodel.modelData.dwid = branch.branchid;
                tempmodel.modelData.dwname = branch.branchname;
                top.layer.close(index)

            })
        },
        seljhsx: function () {

            top.ComFunJS.winbtnwin("/ViewV5/AppPage/JHZD/JHSXSelect.html?iszf=N", "选择计划科目", 500, 470, {}, function (layero, index) {
                var frameid = $("iframe", $(layero)).attr('id');
                var datainfo = ComFunJS.isIE() ? top.window.frames[frameid].getselecteddata() : top.window.frames[frameid].contentWindow.getselecteddata();
                tempmodel.modelData.jhsxid = datainfo.dataid;
                tempmodel.modelData.remark1 = datainfo.datapah;
                tempmodel.modelData.jhsxnamezc = datainfo.dataname;
                //建设费用,营销有合同,设计费
                if (tempmodel.modelData.remark1 == "040101" || tempmodel.modelData.remark1.substr(0, 4) == "0303" || tempmodel.modelData.remark1.substr(0, 4) == "0304") {
                    $("#htdiv").show();
                } else {
                    $("#htdiv").hide();

                }

                $("#jhsxname").val(datainfo.dataname)
                top.layer.close(index)
            })
        },
        inittemp: function (strId) {
            $(".yje").change(function () {
                tempmodel.modelData.jexj = tempmodel.modelData.je1 * 1 + tempmodel.modelData.je2 * 1 + tempmodel.modelData.je3 * 1;
            })
            $.getJSON('/API/VIEWAPI.ashx?Action=JHZC_GETMXINITDATA', { P1: ComFunJS.getQueryString("JHID", "0") }, function (resultData) {
                if (resultData.ErrorMsg == "") {
                    tempmodel.jhdata = resultData.Result[0];
                    tempmodel.modelData.JHID = tempmodel.jhdata.ID;
                    tempmodel.fkjcdata = resultData.Result1;
                    tempmodel.htjddata = resultData.Result2;
                    tempmodel.xmqb = resultData.Result3;
                    tempmodel.dwdata = resultData.Result4;
                    tempmodel.htlb = resultData.Result6;
                    tempmodel.modelData.dwid = tempmodel.dwdata.DeptCode;
                    tempmodel.modelData.dwname = tempmodel.dwdata.DeptName;


                    for (var i = 0; i < resultData.Result5.length; i++) {
                        tempmodel.dfdw.push(resultData.Result5[i].dfdw)
                    }
                    $('.dfdw').typeahead({
                        source: function (query, process) {
                            return tempmodel.dfdw.$model;
                        }
                    })
                    if (strId) {
                        //编辑加载数据
                        $.getJSON('/API/VIEWAPI.ashx?Action=JHBG_GETMODEL', { P1: strId }, function (result) {
                            if (result.ErrorMsg == "") {
                                tempmodel.bgmodelData = result.Result;
                                tempmodel.modelData = JSON.parse(result.Result.Remark2);

                                setTimeout(" ComFunJS.initForm()", 500)
                            }
                        })
                    } else {
                        ComFunJS.initForm()
                    }
                }
            })



        },//初始化
        SaveData: function (callback) {
            tempmodel.bgmodelData.Remark2 = JSON.stringify(tempmodel.modelData.$model)
            $.post("/API/VIEWAPI.ashx?ACTION=JHBG_ADDJHBG", { P1: JSON.stringify(tempmodel.bgmodelData.$model) }, function (result) {
                return callback.call(this, result);
            });
        },
        Complate: function () {
            tempmodel.modelData.jexj = 0;
            tempmodel.modelData.xmqbid = "";

        },
        WFComplate: function () {
            $.post("/API/VIEWAPI.ashx?ACTION=JHBG_ADDJHMXZC", { P1: tempmodel.bgmodelData.ID }, function (result) {

            });
        }
    });//# sourceURL=JHBGXZ.js;
</script>
